package com.example.cpms.service.impl;

import com.example.cpms.entity.Warning;
import com.example.cpms.mapper.WarningMapper;
import com.example.cpms.service.WarningService;
import com.example.cpms.utils.PageBean;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.time.Instant;
import java.util.List;

@Service
public class WarningServiceImpl implements WarningService {
    @Autowired
    private WarningMapper warningMapper;

    @Override
    public PageBean page(Integer page, Integer pageSize, String poleName, String poleNumber, Integer handelStatus) {
        PageHelper.startPage(page,pageSize);
        List<Warning> warningList = warningMapper.list(poleName,poleNumber,handelStatus);
        Page<Warning> p = (Page<Warning>) warningList;
        PageBean pageBean = new PageBean(p.getTotal(),p.getResult());
        return pageBean;
    }

    @Override
    public void delete(Integer id) {
        warningMapper.deleteById(id);
    }



}
